home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / uucp / protocol / wegrzyn.paper < prev    next >
Encoding:
Internet Message Format  |  1991-08-18  |  14.0 KB

  1. Path: clarkson!rpi!usc!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!ucsd!nosc!crash!simpact!cmkrnl!jeh
  2. From: jeh@cmkrnl.uucp
  3. Newsgroups: comp.mail.uucp
  4. Subject: Re: G protocol (Wegrzyn paper)
  5. Message-ID: <1991Aug4.160619.193@cmkrnl.uucp>
  6. Date: 4 Aug 91 23:06:19 GMT
  7. References: <4682@se-sd.SanDiego.NCR.COM> <231@s5000.rsvl.unisys.com> <1991Aug2.012529.10008@uunet.uu.net> <1991Aug4.160256.191@cmkrnl.uucp>
  8. Organization: Kernel Mode Consulting, San Diego CA
  9. Lines: 449
  10.  
  11. The paper on the "G" Protocol which I just posted references articles
  12. by Greg Chesson and Chuck Wegrzyn.  Here is the one by Wegrzyn.
  13.  
  14.     --- Jamie Hanrahan, Kernel Mode Consulting, San Diego CA
  15. Chair, VMS Internals Working Group, U.S. DECUS VAX Systems SIG 
  16. Internet:  jeh@dcs.simpact.com, hanrahan@eisner.decus.org, or jeh@crash.cts.com
  17. Uucp:  ...{crash,eisner,uunet}!cmkrnl!jeh
  18.  
  19.  
  20. This is the second issue; the information below is the start of
  21. what has been collected here.  It is expected that more information
  22. will be collected in the next few weeks, and that information will
  23. be forwarded when/if it becomes available.
  24.  
  25.  =====================================================
  26.  -- part 1
  27.  =====================================================
  28. This information came via several people, most of whom snet this
  29. exact message (probably from their news archives from before we
  30. joined the net):
  31.  
  32.     I am posting this over the network because I believe that
  33.     others are interested in knowing the protocols of UUCP.
  34.     Below is listed all the information that I have acquired
  35.     to date. This includes the initial handshaking phase, though
  36.     not the login phase. It also doesn't include information
  37.     about the data transfer protocol for non-packet networks
  38.     (the -G option left off the uucico command line). But, just
  39.     hold on - I am working on that stuff.
  40.  
  41.     For a point of information : the slave is the UUCP site being
  42.     dialed, and the master is the one doing the calling up. The
  43.     protocols listed in the handshaking and termination phase are
  44.     independent of any UUCP site : it is universal. The stuff in
  45.     the work phase depends on the specific protocol chosen. The
  46.     concepts in the work phase are independent of protocol, ie. the
  47.     sequences are the same. It is just the lower level stuff that
  48.     changes from protocol to protocol. I have access only to level
  49.     g and will document it as I begin to understand it.
  50.  
  51.     Most of the stuff you see here is gotten from the debug phase
  52.     of the current BSD UUCP system.
  53.  
  54.     I hope this is useful. Maybe this will get some of the real
  55.     'brains' in UUCP to get off their duffs and provide some real
  56.     detail. In any case, if you have any questions please feel
  57.     free to contact me. I will post any questions and answers over
  58.     the network.
  59.  
  60.  
  61.                 Chuck Wegrzyn
  62.                 {allegra,decvax,ihnp4}!encore!wegrzyn
  63.  
  64.                 (617) 237-1022
  65.  
  66.  
  67.  
  68.             UUCP Handshake Phase
  69.             ====================
  70.  
  71. Master                            Slave
  72. ------                            -----
  73.  
  74.                     <-----        \020Shere\0     (1)
  75.  
  76.  
  77. (2)  \020S<mastername> <switches>\0    ----->
  78.  
  79.  
  80.                     <-----        \020RLCK\0      (3)
  81.                             \020RCB\0
  82.                             \020ROK\0
  83.                             \020RBADSEQ\0
  84.  
  85.                     <-----        \020P<protos>\0 (4)
  86.  
  87.  
  88. (5) \020U<proto>\0            ----->
  89.     \020UN\0
  90.  
  91.  
  92. (6) ...
  93.  
  94.  
  95. (0) This communication happens outside of the packet communication that
  96.     is supported. If the -G flag is sent on the uucico line, all
  97.     communications will occur without the use of the packet
  98.     simulation software. The communication at this level is just
  99.     the characters listed above.
  100.  
  101. (1) The slave sends the sequence indicated, while the master waits for
  102.     the message.
  103.  
  104. (2) The slave waits for the master to send a response message. The message
  105.     is composed of the master's name and some optional switches.
  106.     The switch field can include the following
  107.  
  108.             -g        (set by the -G switch on the
  109.                      master's uucico command line.
  110.                      Indicates that communication
  111.                      occurs over a packet switch net.)
  112.             -xN        (set by the -x switch on the
  113.                      master's uucico command line.
  114.                      The number N is the debug level
  115.                      desired.)
  116.             -QM        (M is really a sequence number
  117.                      for the communication.)
  118.  
  119.     Each switch is separated from the others by a 'blank' character.
  120.  
  121. (3) The slave will send one of the many responses. The meanings appear to
  122.     be :
  123.  
  124.     RLCK
  125.  
  126.         This message implies that a 'lock' failure occurred:
  127.         a file called LCK..mastername couldn't be created since
  128.         one already exists. This seems to imply that the master
  129.         is already in communication with the slave.
  130.  
  131.     RCB
  132.  
  133.         This message will be sent out if the slave requires a
  134.         call back to the master - the slave will not accept a
  135.         call from the master but will call the master instead.
  136.  
  137.     ROK
  138.  
  139.         This message will be returned if the sequence number that
  140.         was sent in the message, attached to the -Q switch, from 
  141.         the master is the same as that computed on the slave.
  142.  
  143.     RBADSEQ
  144.  
  145.         Happens if the sequence numbers do not match.
  146.  
  147.     (Notes on the sequence number - if a machine does not keep
  148.      sequence numbers, the value is set to 0. If no -Q switch
  149.      is given in the master's line, the sequence number is
  150.      defaulted to 0.
  151.  
  152.      The sequence file, SQFILE, has the format
  153.  
  154.         <remotename> <number> <month>/<day>-<hour>:<min>
  155.  
  156.      where <remotename> is the name of a master and <number>
  157.      is the previous sequence number. If the <number> field
  158.      is not present, or if it is greater than 9998, it is
  159.      set to 0. The <number> field is an ascii representation
  160.      of the number. The stuff after the <number> is the time
  161.      the sequence number was last changed, this information
  162.      doesn't seem important.)
  163.  
  164. (4) The slave sends a message that identifies all the protocols that
  165.     it supports. It seems that BSD supports 'g' as the normal case.
  166.     Some sites, such as Allegra, support 'e' and 'g', and a few
  167.     sites support 'f' as well. I have no information about these
  168.     protocols. The exact message sent might look like
  169.  
  170.         \020Pefg\0
  171.  
  172.     where efg indicates that this slave supports the e,f and g 
  173.     protocols.
  174.  
  175. (5) The slave waits for a response from the master with the chosen
  176.     protocol. If the master has a protocol that is in common the
  177.     master will send the message
  178.  
  179.         \020U<proto>\0
  180.  
  181.     where <proto> is the protocol (letter) chosen. If no protocol
  182.     is in common, the master will send the message
  183.  
  184.         \020UN\0
  185.  
  186. (6) At this point both the slave and master agree to use the designated
  187.     protocol. The first thing that now happens is that the master
  188.     checks for work.
  189.  
  190. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  191.  
  192.             UUCP Work Phase
  193.             ===============
  194.  
  195.  
  196. Master                            Slave
  197. ------                            -----
  198.  
  199. (a) Master has UUCP Work
  200.  
  201.     (1) X file1 file2     ----->
  202.  
  203.                     <-----        XN        (2)
  204.                             XY
  205.  
  206.     When the master wants the slave to do a 'uux' command
  207.     it sends the X message. If the slave can't or won't
  208.     do it, the slave will send an XN message. Otherwise
  209.     it will send an XY message.
  210.  
  211. (b) Master wants to send a file
  212.  
  213.     (1) S file1 file2 user options  ----->
  214.  
  215.                     <-----        SN2        (2)
  216.                             SN4
  217.                             SY
  218.  
  219.             <---- <data exchanged>---->            (3)
  220.  
  221.  
  222.                     <-----        CY        (4)
  223.                             CN5
  224.  
  225.     If the master wishes to send a file to the slave, it will
  226.     send a S message to the slave. If the slave can or will do
  227.     the transfer, it sends a SY message. If the slave has a
  228.     problem creating work files, it sends a SN4 message. If
  229.     the target file can't be created (because of priv's etc)
  230.     it sends a SN2 message.
  231.  
  232.     The file1 argument is the source file, and file2 is the
  233.     (almost) target filename. If file2 is a directory, then
  234.     the target filename is composed of file2 concatenated
  235.     with the "last" part of the file1 argument. Note, if the
  236.     file2 argument begins with X, the request is targeted to
  237.     UUX and not the normal send.
  238.  
  239.     The user argument indicates who, if anyone, is to be notified
  240.     if the file has been copied. This user must be on the slave
  241.     system.
  242.  
  243.     I am not sure what the options argument does.
  244.  
  245.     After the data has been exchanged the slave will send one of
  246.     two messages to the master. A CY message indicates that every-
  247.     thing is ok. The message CN5 indicates that the slave had
  248.     some problem moving the file to it's permanent location. This
  249.     is not the same as a problem during the exchange of data : this
  250.     causes the slave to terminate operation.
  251.  
  252. (c) Master wishes to receive a file.
  253.  
  254.     (1) R file1 file2 user    ----->
  255.  
  256.                         <-----    RN2        (2)
  257.                             RY mode
  258.  
  259.     (3)        <---- <data exchanged> ---->
  260.  
  261.     (4)    CY        ----->
  262.         CN5
  263.  
  264.     If the master wishes the slave to send a file, the master sends
  265.     a R message. If the slave has the file and can send it, the
  266.     slave will respond with the RY message. If the slave can't find
  267.     the file, or won't send it the RN2 message is sent. It doesn't
  268.     appear that the 'mode' field of the RY message is used.
  269.  
  270.     The argument file1 is the file to transfer, unless it is a
  271.     directory. In this case the file to be transferred is built
  272.     of a concatenation of file1 with the "last" part of the file2
  273.     argument.
  274.  
  275.     If anything goes wrong with the data transfer, it results in
  276.     both the slave and the master terminating.
  277.  
  278.     After the data has been transferred, the master will send an
  279.     acknowledgement to the slave. If the transfer and copy to the
  280.     destination file has been successful, the master will send the
  281.     CY message. Otherwise it will send the CN5 message.
  282.  
  283. (d) Master has no work, or no more work.
  284.  
  285.     (1) H            ----->
  286.  
  287.                 <-----                HY    (2)
  288.                                 HN
  289.  
  290.     (3) HY            ----->
  291.  
  292.                 <----                HY    (4)
  293.  
  294.     (5) ...
  295.  
  296.     The transfer of control is initiated with the master sending
  297.     a H message. This message tells the slave that the master has
  298.     no work, and the slave should look for work.
  299.  
  300.     If the slave has no work it will respond with the HY message.
  301.     This will tell the master to send an HY message, and turn off
  302.     the selected protocol. When the HY message is received by the
  303.     slave, it turns off the selected protocol as well. Both the
  304.     master and slave enter the UUCP termination phase.
  305.  
  306.     If the slave does have work, it sends the HN message to the
  307.     master. At this point, the slave becomes the master. After
  308.     the master receives the HN message, it becomes the slave.
  309.     The whole sequence of sending work starts over again. Note,
  310.     the transmission of HN doesn't force the master to send any
  311.     other H messages : it waits for stuff  from the new master.
  312.  
  313. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  314.  
  315.  
  316.             UUCP Termination Sequence
  317.             =========================
  318.  
  319.  Master                                Slave
  320.  ------                                -----
  321.  
  322.  (1) \020OOOOOO\0        ----->
  323.  
  324.                 <-----            \020OOOOOOO\0 (2)
  325.  
  326.  
  327.  
  328.     At this point all conversation has completed normally.
  329.  
  330.  
  331. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  332.  
  333.             UUCP Data Transfers
  334.             ===================
  335.  
  336.     After the initial handshake the systems send messages in one
  337.     of two styles : packet and not packet. A Packet protocol is
  338.     just raw data transfers : there is no protocol or acknowledgements;
  339.     this appears to assume that the lower level is a packet network
  340.     of some type. If the style is not Packet, then extra work is
  341.     done. I am still working on this stuff.
  342.  
  343.  =====================================================
  344.  -- part 2
  345.  =====================================================
  346.  ** summary of UUCP packets ** 
  347. (this is much like part 1, but shortened and compared against a
  348. live UUCP ~uucp_adm/uucico)
  349.  
  350. note that all transmissions end with a null, not shown here
  351.  
  352.  
  353. (master)        (slave)
  354.  
  355.  ... dials up ...    <DLE>Shere        says "hello"
  356.  
  357. <DLE>S<sysname> <opts>                says who he is
  358.  
  359.         |    <DLE>ROK        says ok to talk
  360.         |    <DLE>RLCK        says locked out
  361.         |    <DLE>RCB        says will call back
  362.         |    <DLE>RBADSEQ        says bad seq num
  363.  
  364.             <DLE>P<protos>        what protocols he has
  365.  
  366. <DLE>U<proto>    |                which to use
  367. <DLE>UN        |                use none, hang up
  368.  
  369.  
  370. packet driver is turned on at this time, if not told otherwise
  371.  
  372.  -- if master has work --
  373.  
  374. to sned file to slave...
  375. S <mfilenm> <sfilenm> <user> <opts>        request to sned file
  376.  
  377.         |    SY            ok -- i'll take it
  378.         |    SN2            not permitted
  379.         |    SN4            can't make workfile
  380.  
  381. <data>                        the file is transmitted
  382.  
  383.         |    CY            finished OK
  384.         |    CN5            can't move into place
  385.  
  386.  
  387. to recv file from slave...
  388. R <sfilenm> <mfilenm> <user>            request to recv file
  389.  
  390.         |    RY<mode>        ok -- here is prot mode
  391.         |    RN2            not permitted
  392.  
  393.             <data>            file is transmitted
  394.  
  395. CY        |                worked
  396. CN5        |                can't move into place
  397.  
  398.  
  399. to do UUX on slave...
  400. X <file1> <file2>                request to exec file
  401.  
  402.         |    XY            ok -- will do
  403.         |    XN            nopers
  404.  
  405. to indicate that he has no more work...
  406. H                        no more work
  407.  
  408.         |    HN            reverse roles
  409.         |    HY            no work here either
  410.  
  411. to accept slave's claim of no more work...
  412.  
  413. HY                        agrees to hang up
  414.  
  415. the rest of the hang-up is done OUTSIDE of packet driver
  416. <DLE>OOOOOO                    signs off (6*'O')
  417.  
  418.             <DLE>OOOOOOO        signs off (7*'O')
  419.     
  420.  
  421. If the slave has work, then the roles are reversed, and the
  422. session proceeds from the label 'loop1' above.  The system
  423. which was the slave is now the master, and the old master is
  424. just the slave.
  425.  
  426. The <opts> which follow the system name for the start-up sequence
  427. include:
  428.     -g        don't use packet driver (command line -G)
  429.     -xN        debug level (command line -Xn)
  430.     -QN        seq number (if systems use this)
  431.  
  432. The filenames for <mfilenm> should be complete filenames with
  433. path information; otherwise they are assumed to be in /usr/spool/uucp.
  434. The filenames for <sfilenm> should be either complete filenames
  435. or directory names.  If directory names are used, then the final
  436. componant of <mfilenm> is appended to form the complete filename.
  437.  
  438. The 'X' command to do UUX on a slave is more than a little unclear.
  439. It doesn't seem to work here, but that may be a microsoft "feature".
  440.  
  441.  
  442. Protocol "g", which seems to be the one most commonly used, is supposed
  443. to be a slightly munged version of level 2 of X.25; an article was just
  444. posted in net.unix-wizards (which you probably have already seen) to
  445. this effect.  The article didn't provide any details on the protocol,
  446. but merely mentioned the modifications.
  447.  
  448. The "packet" mode, with no protocol, does not work under microsoft
  449. implementations, and may have *lots* of trouble working anywhere
  450. else as well.  It evidently requires that zero-length reads happen
  451. every so often to delimit things, such as files being transferred.
  452. This of course can't happen without the packet driver, which was long
  453. gone by the time sys-3 or sys-5 or <your current version> came along.
  454.  
  455. **********************************
  456. ** end of issue #2
  457. **********************************
  458.  
  459. (end)
  460.